import json import base64 import cryptography # The decription function data = str(base64.urlsafe_b64decode("NDksNiBZSQ=="), "utf-8") print(data) encrypted2 = '' i = len(data) - 1 while i >= 0: encrypted2 = encrypted2 + data[i] i = i - 1 encrypted2 =str(encrypted2) print(encrypted2) def cipher_decrypt(ciphertext, key): decrypted = "" for c in ciphertext: if c.isupper(): c_index = ord(c) - ord('A') # shift the current character to left by key positions to get its original position c_og_pos = (c_index - key) % 26 + ord('A') c_og = chr(c_og_pos) decrypted += c_og elif c.islower(): c_index = ord(c) - ord('a') c_og_pos = (c_index - key) % 26 + ord('a') c_og = chr(c_og_pos) decrypted += c_og elif c.isdigit(): # if it's a number,shift its actual value c_og = (int(c) - key) % 10 decrypted += str(c_og) else: # if its neither alphabetical nor a number, just leave it like that decrypted += c return decrypted decrypted_message = cipher_decrypt(encrypted2, 4) print(decrypted_message) decodedBytes = base64.urlsafe_b64encode(decrypted_message.encode("utf-8")) p_decoded = str(decodedBytes, "utf-8") print(p_decoded) data_decoded = str(base64.urlsafe_b64decode(p_decoded), "utf-8") print(data_decoded)